package day16_porxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author xinxing
 * @date 2023/2/6 16:27
 */
public class JDKProxyHandler implements InvocationHandler {

    private Object target;

    public JDKProxyHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("执行前.....");
        Object invoke = method.invoke(target, args);
        System.out.println("执行后.....");
        return invoke;
    }
}
